<template>
  <el-container>
    <el-main>
      <iframe
        :src="fileUploadForm.signUrl"
        class="iframe"
        width="100%"
        frameborder="0"
        allowfullscreen="true"
      />
      <div class="text-center">
        <el-button @click="$router.push('/waterMark')">返回</el-button>
      </div>
    </el-main>
  </el-container>
</template>

<script>
import addtable from "@/mixins/addtable";
import { getTestCompany, queryItems, findByIdDetail } from "./api";
import { getCompanyList } from "@/api";
import { getToken } from "@/utils/auth";
import eventType from "@/mixins/eventType";
import uploadItem from "./upload-item";
export default {
  mixins: [addtable, eventType],
  components: {
    uploadItem,
  },
  data() {
    return {
      fileUploadForm: {
        fileId: "",
        fileUrl: "",
        fileName: "",
        signFileKey: "",
        signFileUrl: "",
        signFlowId: null,
        signUrl: "",
      },
      filesForm: {
        reportName: "",
        lpUnitId: "",
        unitName: "",
        chargePerson: "",
        linkTelephone: "",
        testingInstitutionId: "",
        startValidate: "",
        endValidate: "",
        signFlowId: "",
        checkOpinion: "",
        checkStatus: 0,
        institutionName: "",
        qualifiedGrade: "",
        testingReportId: "",
        date: "",
        unitType: "",
        fileFullPath: "",
        qualifiedGrade: "",
      },
    };
  },

  created() {
    this.filesForm.testingReportId = this.$route.query.reportId || "";
    if (this.filesForm.testingReportId) {
      this.getDetail();
    }
  },

  methods: {
    getDetail() {
      findByIdDetail(this.filesForm.testingReportId)
        .then(({ data }) => {
          console.log("🚀 ~ file: upload.vue ~ line 376 ~ .then ~ data", data);
          for (const key in data) {
            this.filesForm[key] = data[key];
            this.fileUploadForm[key] = data[key];
          }
        })
        .catch((err) => {});
    },

    init() {
      this.$router.push("waterMark");
    },
  },
};
</script>

<style lang="scss" scoped>
.upload-main {
  width: 1000px;
  background: #fff;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 20px;
}

.upload-item {
  height: 200px;
  box-sizing: border-box;
  padding: 0 120px;
}

.upload {
  display: flex;
  justify-content: center;
  > div {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

.iframe {
  height: calc(100vh - 110px);
}
</style>
